package com.yjd.comm.easycard.service;

import java.util.Map;

import com.yjd.comm.base.model.PagerModel;
import com.yjd.comm.base.service.IBaseService;
import com.yjd.comm.easycard.dto.EasycardPageItemDTO;
import com.yjd.comm.easycard.model.EasycardModel;
import com.yjd.comm.system.dto.OperParamDto;
import com.yjd.comm.user.model.UserModel;

/**
 * <b>description</b>：易借卡表业务接口<br>
 * <b>time</b>：2015-04-11 00:54:07 <br>
 * <b>author</b>：  Song devpage@126.com
 */
public interface IEasycardService extends IBaseService {
	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public EasycardModel insert(EasycardModel model) throws Exception;

	/**
	 * 更新,大于等于1表示成功，其他失败
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(EasycardModel model) throws Exception;

	/**
	 * 根据id删除,大于等于1表示成功，其他失败
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int delete(Long id) throws Exception;
	
	/**
	 * 生成一张易借卡
	 * @param base_id
	 * @param opt
	 * @return
	 * @throws Exception
	 */
	public int generateEasycard(Long base_id,OperParamDto opt) throws Exception;
	
	/**
	 * 变更一张易借卡
	 * @param base_id
	 * @param opt
	 * @return
	 * @throws Exception
	 */
	public int exchange_card(Long base_id,OperParamDto opt,String reason) throws Exception;
	
	/**
	 * 易借卡列表分页
	 * @param paramMap
	 * @return
	 * @throws Exception
	 */
	public PagerModel getEasycardPage(Map paramMap) throws Exception;
	
	/**
	 * 获取易借卡详情
	 * @param paramMap
	 * @return
	 * @throws Exception
	 */
	public EasycardPageItemDTO getEasycardDetails(Map paramMap) throws Exception;
	
	/**
	 * 激活易借卡
	 * @param user
	 * @param easycard_id
	 * @param phone
	 * @return
	 * @throws Exception
	 */
	public int activeCard(UserModel user, Long easycard_id, String phone) throws Exception;
	
	/**
	 * 根据map更新数据
	 * 
	 * @param paramMap
	 * @param write
	 *            是否是操作主库
	 * @return
	 * @throws Exception
	 */
	public int updateByMap(Map<Object, Object> paramMap, boolean write)
			throws Exception;

}
